package com.xoa.service.WFE.WFEFactory;

import com.xoa.dao.WFE.WFEFormTypeMapper;
import com.xoa.model.workflow.FlowFormType;
import com.xoa.util.HtmlUtil;
import org.jsoup.nodes.Document;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WFEFormData {


    @Autowired
    WFEFormTypeMapper wfeFormTypeMapper;

    /**
     * 获取表单信息文本对象
     *
     * @param flowId 流程表Id号
     * @return
     */
    public Document getFormDocument(Integer flowId) {
        List<FlowFormType> forms = wfeFormTypeMapper.getFrombyFlowId(flowId);
        FlowFormType formType = forms.get(0);
        //获取表单信息
        Document document = HtmlUtil.getDom(formType.getPrintModel());
        return document;
    }
}
